import Mock from 'mockjs';

// 登录 post API
Mock.mock('/api/login','post',(options)=>{
    let {username,password}=JSON.parse(options.body);
    
    if(username==='admin' && password==="123"){
        return {
            code:0,
            message:"登陆成功",
            token:"admin"+new Date().getTime()
        }
    }else{
        return {
            code :1,
            message:"用户名或密码错误",
            token:""
        }
    }
 });

 // 教师列表
 const teacher_data=Mock.mock({"list|100":[
     {
         id:"@id",
         key:"@id",
         name:"@cname",
         "gender|1":["男","女"],
         "age|24-50":1,
         "clzss|1":["1803A","1803B","1804A","1805A","1807A"],
         desc:"@ctitle(20,50)",
         "year|1":["2018","2019","2020"],
         image:"@image(100X100,@color,@name)"

     }
 ]})
 
 Mock.mock('/api/teacher/list',{
     code:0,
     data:teacher_data.list
 })